# coding=utf-8
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from app.author import utils
from django.contrib import auth
from django.template import RequestContext

def login(request):
    if utils.isLogin(request):
        return HttpResponseRedirect('/manager')
    else:
        return render_to_response('author/login.html',{},context_instance=RequestContext(request))
    
def logout(request):
    auth.logout(request)
    return render_to_response('author/login.html',{},context_instance=RequestContext(request))

def action(request,method):
    from app.author import actions
    return actions.__dict__[method](request)
